function [discount,beca,stipend] = u42_2012(math,lang,demrecode,his,sci)
%% Universidad Adolfo Ibanez
lm=(math+lang)/2;
beca=zeros(size(lm,1),1);
stipend=zeros(size(lm,1),1);

%Beca puntaje nacional
discount=(((math==850) + (lang==850) + (his==850) + (sci==850))>0);

%Beca Pedro Luis Gonzalez
if demrecode==42001 || demrecode==42021 || demrecode==42002 || demrecode==42022
    auxdiscount=0.75*(lm>=750);
    discount=max(discount,auxdiscount);
elseif (demrecode==42003 || demrecode==42023 || demrecode==42004 || demrecode==42024 || demrecode==42005 || demrecode==42025)
    auxdiscount=0.75*(lm>=720);
    discount=max(discount,auxdiscount);
elseif (demrecode==42001 || demrecode==42021 || demrecode==42002 || demrecode==42022 || demrecode==42003 || demrecode==42023 || demrecode==42004 || demrecode==42024)
    auxdiscount=0.5*(lm>=700);
    discount=max(discount,auxdiscount);
elseif (demrecode==42005 || demrecode==42025)
    auxdiscount=0.5*(lm>=650);
    discount=max(discount,auxdiscount);
elseif demrecode==42021
    auxdiscount=0.25*(lm>=680);
    discount=max(discount,auxdiscount);
elseif (demrecode==42002 || demrecode==42022 || demrecode==42003 || demrecode==42023 || demrecode==42004 || demrecode==42024)
    auxdiscount=0.25*(lm>=650);
    discount=max(discount,auxdiscount);
elseif (demrecode==42024 || demrecode==42025)
    auxdiscount=0.25*(lm>=600);
    discount=max(discount,auxdiscount);
end

%NO BVP

end
